import * as actionTypes from '../../constants/index';
const blacklist = (state=[], action) => {
  switch (action.type) {
    case actionTypes.GET_BLACK_LIST:
      return [...action.data];
    // case actionTypes.REMOVE_BLACK_BY_ID:
    //   return state.filter((item) => {
    //     if (item.id !== action.data) {
    //       return item
    //     }
    //   });
    // case actionTypes.ADD_BLACK_LIST:
    //   return [...state, action.data];
    // case actionTypes.REMOVE_BLACK_LIST:
    //   return state.filter((item) => item !==state.splice(action.data, 1)[0])
    default:
      return state;
  }
};

const keywordList = (state=[], action) => {
  switch (action.type) {
    case actionTypes.GET_KEYWORD:
      return [...action.data];
    // case actionTypes.ADD_BLACK_LIST:
    //   return [...state, action.data];
    // case actionTypes.REMOVE_BLACK_LIST:
    //   return state.filter((item) => item !==state.splice(action.data, 1)[0])
    default:
      return state;
  }
};

const modal = (state=false, action) => {
  switch (action.type) {
    case actionTypes.SHOW_MODAL:
      return true;
    case actionTypes.HIDE_MODAL:
      return false;
    default:
      return state;
  }
};
export {blacklist,modal,keywordList};
